<template>
	<view class="content">
		<header-top :messageInfo="{typeFlag:true,message:'提现'}"></header-top>
		<view class="toububjt">
			<view class="xiaobtext">可提现金额（元）</view>
			<view class="dbaitext">￥{{userinfo.money==null?0:userinfo.money}}</view>
		</view>
		<view class="mainpadding">
			<view class="neirong">
				<view class="mainpadding ffffff circle margin-top">
					<view class="text_a color_three">提现金额 (元)</view>
					<view class="flexbetween margin_top">
						<view class="flexleft" style="flex: 4;">
							<view class="">￥</view>
							<!-- 	<input type="number"placeholder=""> -->
							<input type="number" v-model="price" placeholder="请输入提现金额" class="daheitext">
						</view>
						<view class="huangsetext" style="flex: 1.1;" @click="allprice">全部提现</view>
					</view>
				</view>
				<view class="mainpadding ffffff circle margin_top" v-if="userinfo.open_bank">
					<view class="text_x color_ling" style="font-size: 32rpx;">提现至</view>
					<view class="methods-item mainpadding ffffff flexbetween">
						<view class="left flexcenter">
							<u-icon name="coupon-fill" color="#fab536" size="24"></u-icon>
							<!-- <view class="name flex1">银行卡</view> -->
							<view>{{userinfo.open_bank}}</view>
							<view class="name flex1">{{userinfo.bank_account_text}}</view>
						</view>
						<view class="right">
							<image v-if="!activeIndexJF" src="/static/image/index/my.png "
								style="width: 34rpx;height: 34rpx;"></image>
							<image v-if="activeIndexJF" src="/static/image/index/xuan.png "
								style="width: 34rpx;height: 34rpx;"></image>
						</view>
					</view>
				</view>
				<!-- 注意 -->
				<view>
					<u-parse :content="withdrawal_notes"></u-parse>
				</view>
				<view class="footer_btn tixian" style="margin-top: 20rpx;" @click="tixian">提现</view>
				<view class="text text_green jilu" @click="tixianjl">提现记录</view>
			</view>
		</view>
	</view>
</template>
<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				money: '',
				price: '', // 提现金额
				userinfo: {}, // 用户信息
				withdrawal_notes:"",//提现备注
			}
		},
		onLoad() {
			
		},
		onShow() {
			this.getConfig()
			this.getinfo()
		},
		methods: {
			getConfig() { //系统配置
				let _this = this
				httpRequest.request('/employeesapi/index/getConfigInfo', 'GET', {
			
				}).then(res => {
					// console.log(res);
					_this.withdrawal_notes = res.data.withdrawal_notes
				})
			},
			// 用户信息
			getinfo() {
				let _this = this
				httpRequest.request('/employeesapi/user/index', 'GET', {

				}).then(res => {
					// console.log(res);
					_this.userinfo = res.data
				})
			},
			allprice() { // 全部提现
				let _this = this
				_this.price = _this.userinfo.money
			},
			tixian() { // 提现
				let _this = this
				if (_this.price == '') {
					httpRequest.toast('请输入提现金额');
					return
				}
				httpRequest.request('/employeesapi/user/addWithdrawal', 'GET', {
					price: _this.price,
					type: 3
				}).then(res => {
					if (res.code == 1) {
						httpRequest.toast(res.msg);
						setTimeout(() => {
							uni.navigateBack(1)
						},1000)
					}else{
						httpRequest.toast(res.msg);
					}
				})
			},
			tixianjl() { //提现记录
				uni.navigateTo({
					url: "/pages/mypage/tijianjl"
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	view.text1 {
		font-size: 28rpx;
		text-align: center;
		font-weight: normal;
		color: RGBA(255, 146, 67, 1);
	}

	.methods-item {
		padding-left: 0;
		padding-right: 0;
		border-bottom: 2rpx solid #fafafa;
	}

	.methods-item:last-child {
		border-bottom: 0;
	}

	.wx {
		width: 36rpx;
		height: 36rpx;
		background-size: 100% 100%;
		margin-right: 4rpx;
		margin-left: 4rpx;
	}

	.tixian {
		// margin-top: 200rpx;
	}

	.jilu {
		margin-top: 20rpx;
		font-size: 34rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #3476fe;
		text-align: center;
	}

	.circle {
		border-radius: 20rpx 20rpx 20rpx 20rpx;
	}

	.huangsetext {
		font-size: 34rpx;
		font-family: PingFang SC-Medium, PingFang SC;
		font-weight: 500;
		color: #3476fe;
	}

	.neirong {
		position: relative;
		top: -120rpx;
	}

	.dbaitext {
		font-size: 44rpx;
		font-family: PingFang SC-Heavy, PingFang SC;
		font-weight: 800;
		color: #FFFFFF;
	}

	.xiaobtext {
		font-size: 30rpx;
		font-family: PingFang SC-Heavy, PingFang SC;
		font-weight: 800;
		color: #FFFFFF;
		margin-bottom: 20rpx;
	}

	.toububjt {
		width: 100%;
		padding: 40rpx 30rpx 0;
		height: 258rpx;
		box-sizing: border-box;
		background-color: #3476fe;
	}

	.daheitext {
		font-size: 40rpx;
		font-family: DIN Next LT Pro-Regular, DIN Next LT Pro;
		font-weight: 400;
		color: #333333;
		// margin-top: 20rpx;
	}

	.footer_btn {
		font-size: 36rpx;
		font-weight: 500;
		color: #FFFFFF;
		text-align: center;
		padding: 20rpx 20rpx;
		background-color: #3476fe;
		border-radius: 64rpx;
	}
	
	.warnBox{
		padding: 0 100rpx;
	}
	.textcenter{
		text-align: center;
	}
</style>